<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>换衣服</title>
  <style>
    #box {
      position: relative;
    }

    #myImg {
      position: absolute;
      top: 0;
      left: 0;
    }

    a {
      display: block;
      width: 25px;
      height: 25px;
      border-radius: 3px;
      text-indent: 100%;
      overflow: hidden;
      float: left;
      margin: 2px;
    }

    span {
      display: block;
      height: 100%;
    }
  </style>
</head>

<body>
  <div id="box">
    <img src="./img/blank_tshirt.jpg">
    <img src="./img/shirt-mask.png" id="myImg">
  </div>

  <div class="swatch">
    <a rel="255,255,255" href="#mask" title="White">
      <span style="background: rgba(255, 255, 255, 0.75);">White</span>
    </a>
    <a rel="32,223,95" class="active" title="Green">
      <span style="background: rgba(32, 223, 95, 0.75);">Green</span>
    </a>
    <a rel="255,211,8" href="#mask" class="" title="Yellow">
      <span style="background: rgba(255, 211, 8, 0.75);">Yellow</span>
    </a>
    <a rel="255,101,8" href="#mask" class="" title="Orange">
      <span style="background: rgba(255, 101, 8, 0.75);">Orange/a&gt;
      </span>
    </a>
    <a rel="16,200,255" href="#mask" class="" title="Blue">
      <span style="background: rgba(16, 200, 255, 0.75);">Blue</span>
    </a>
    <a rel="142,8,255" href="#mask" class="" title="Purple">
      <span style="background: rgba(142, 8, 255, 0.75);">Purple</span>
    </a>
    <a rel="245,25,45" href="#mask" class="" title="Red">
      <span style="background: rgba(245, 25, 45, 0.75);">Red</span>
    </a>
  </div>
  <script src="https://cdn.bootcss.com/jquery/1.10.0/jquery.min.js
  "></script>
  <script>
    $('span').click(function () {
      var a = $(this).css('background');
      $('#myImg').css('background', a);
    })
  </script>
</body>

</html>